{include file='admin/header.html'}

<form class="layui-form" action="">
    {if $langs}
    <div class="layui-row">
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">{$tran.language}</label>
                    <div class="layui-input-block">
                        <select name="_lang" lay-verify="required" disabled="disabled">
                            {foreach from="$langs" item="_lang"}
                            <option value="{$_lang.slug}" data-voice="{$_lang.voice}" {if $_lang.slug=='zh-CN'} selected="selected"{/if} disabled="disabled">{$_lang.name}（{$_lang.title}）</option>
                            {/foreach}
                        </select>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label"></label>
                    <div class="layui-input-inline">
                        <select name="lang" class="i18n-lang" data-id="{$row.id}" lay-filter="i18nlang" lay-verify="required">
                            <option value="">{$tran.choose}</option>
                            {foreach from="$langs" item="_lang"}
                            <option value="{$_lang.slug}" data-voice="{$_lang.voice}" {if $_lang.slug==$tlang} selected="selected"{/if} {if !in_array($_lang.slug, $lang_slugs) || $_lang.slug=='zh-TW'} disabled="disabled"{/if}>{$_lang.name}（{$_lang.title}）{if in_array($_lang.slug, $has_langs)}√{/if}</option>
                            {/foreach}
                        </select>
                    </div>
                    <button type="button" class="layui-btn layui-btn-normal fill-translate"><i class="layui-icon layui-icon-fonts-clear"></i> {$tran.translate}</button>
                    <button type="button" class="layui-btn layui-btn-warm" id="write-db" style="margin-right: 10px;">Write</button>
                    <input type="checkbox" title="Auto" lay-skin="primary" lay-filter="auto-db">
                </div>
            </div>
        </div>
    </div>
    <!--临时翻译校验结果-->
    <div class="layui-row">
        <div class="layui-col-md6">
            <div class="layui-form-item"></div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label">&rarr;</label>
                <div class="layui-input-block">
                    <div class="layui-form-mid layui-word-aux">
                        <span id="chk-loading" class="layui-hide"><i class="layui-icon layui-icon-loading-1 layui-anim layui-anim-rotate layui-anim-loop"></i> Waiting for auto translate ...</span>
                        <span id="chk-res"></span>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--临时翻译校验结果 end-->
    {/if}
    <div class="layui-row">
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label">{$tran.category_name}</label>
                <div class="layui-input-inline">
                    <input type="text" name="_name" value="{$row.name}" required lay-verify="required"
                        placeholder="{$tran.input_category_name}" autocomplete="off" class="layui-input i18n-sl"
                        disabled="disabled">
                </div>
            </div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label i18n-tran">⇄</label>
                <div class="layui-input-inline">
                    <input type="text" name="name" value="{if $row2}{$row2.name}{/if}" required lay-verify="required"
                        placeholder="{$tran.input_category_name}" autocomplete="off" class="layui-input i18n-tl">
                </div>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label">{$tran.slug}</label>
                <div class="layui-input-inline">
                    <input type="text" name="_slug" value="{$row.slug}" placeholder="" autocomplete="off"
                        class="layui-input" disabled="disabled">
                </div>
            </div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label"></label>
                <div class="layui-input-inline">
                    <input type="text" name="slug" value="{if $row2}{$row2.slug}{else}{$row.slug}{/if}" placeholder=""
                        autocomplete="off" class="layui-input" readonly="readonly">
                </div>
                <div class="layui-form-mid layui-word-aux">{$tran.not_modify}</div>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label">{$tran.parent_category}</label>
                <div class="layui-input-inline">
                    <select name="_pid" lay-verify="required" class="i18n-sl">
                        <option value="">{$tran.choose}</option>
                        <option value="0" {if $row.pid==0} selected{/if}>{$tran.top_category}</option>
                        {foreach from="$category" item="_category"}
                        <option value="{$_category.id}" {if $row.pid==$_category.id} selected{/if}>{$_category.tree_name}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label i18n-tran">⇄</label>
                <div class="layui-input-inline">
                    <select name="pid" lay-verify="required" class="i18n-tl">
                        <option value="">{$tran.choose}</option>
                        <option value="0" {if !$row2 || $row2.pid==0} selected{/if}>{$tran.top_category}</option>
                        {foreach from="$category2" item="_category"}
                        <option value="{$_category.id}" {if $row2 && $row2.pid==$_category.id} selected{/if}>{$_category.tree_name}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-col-md6">
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">{$tran.description}</label>
                <div class="layui-input-block">
                    <textarea name="_description" placeholder="" class="layui-textarea i18n-sl"
                        disabled="disabled">{$row.description}</textarea>
                </div>
            </div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label i18n-tran">⇄</label>
                <div class="layui-input-block">
                    <textarea name="description" placeholder=""
                        class="layui-textarea i18n-tl">{if $row2}{$row2.description}{/if}</textarea>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label">{$tran.sort}</label>
                <div class="layui-input-inline">
                    <input type="number" name="_sort" value="{$row.sort}" required lay-verify="required|number"
                        placeholder="{$tran.input_sort}" autocomplete="off" class="layui-input" disabled="disabled">
                </div>
            </div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label"></label>
                <div class="layui-input-inline">
                    <input type="number" name="sort" value="{if $row2}{$row2.sort}{else}{$row.sort}{/if}" required
                        lay-verify="required|number" placeholder="{$tran.input_sort}" autocomplete="off"
                        class="layui-input">
                </div>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label">SEO {$tran.title}</label>
                <div class="layui-input-block">
                    <input type="text" name="_seo_title" value="{$row.seo_title}" placeholder="" autocomplete="off"
                        class="layui-input i18n-sl" disabled="disabled">
                </div>
            </div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label i18n-tran">⇄</label>
                <div class="layui-input-block">
                    <input type="text" name="seo_title" value="{if $row2}{$row2.seo_title}{/if}" placeholder="" autocomplete="off"
                        class="layui-input i18n-tl">
                </div>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-col-md6">
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">SEO {$tran.description}</label>
                <div class="layui-input-block">
                    <textarea name="_seo_description" placeholder="" class="layui-textarea i18n-sl"
                        disabled="disabled">{$row.seo_description}</textarea>
                </div>
            </div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label i18n-tran">⇄</label>
                <div class="layui-input-block">
                    <textarea name="seo_description" placeholder=""
                        class="layui-textarea i18n-tl">{if $row2}{$row2.seo_description}{/if}</textarea>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label">{$tran.cover}</label>
                <div class="layui-input-inline">
                    <input type="text" name="_cover" value="{$row.cover}" placeholder="" autocomplete="off"
                        class="layui-input" disabled="disabled">
                </div>
            </div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label"></label>
                <div class="layui-input-inline">
                    <input type="text" name="cover" value="{if $row2}{$row2.cover}{else}{$row.cover}{/if}"
                        placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label">{$tran.gallery}</label>
                <div class="layui-input-block">
                    <input type="hidden" name="_is_gallery" value="0" disabled="disabled">
                    <input type="checkbox" name="_is_gallery" value="1" {if $row.is_gallery==1} checked{/if}
                        lay-skin="switch" lay-text="ON|OFF" disabled="disabled">
                </div>
            </div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label"></label>
                <div class="layui-input-block">
                    <input type="hidden" name="is_gallery" value="0">
                    <input type="checkbox" name="is_gallery" value="1" {if $row2 && $row2.is_gallery==1} checked{/if}
                        lay-skin="switch" lay-text="ON|OFF">
                </div>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label">{$tran.status}</label>
                <div class="layui-input-block">
                    <input type="hidden" name="_status" value="1" disabled="disabled">
                    <input type="checkbox" name="_status" value="0" lay-skin="switch" {if $row.status==0} checked{/if}
                        lay-text="ON|OFF" disabled="disabled">
                </div>
            </div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label"></label>
                <div class="layui-input-block">
                    <input type="hidden" name="status" value="1">
                    <input type="checkbox" name="status" value="0" lay-skin="switch" {if !$row2 || $row2.status==0} checked{/if}
                        lay-text="ON|OFF">
                </div>
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-col-md12">
            <div class="layui-form-item" style="text-align: center;">
                <div class="layui-input-block">
                    <input type="hidden" name="_id" value="{$row.id}">
                    <input type="hidden" name="id" value="{if $row2}{$row2.id}{/if}">
                    <button type="button" class="layui-btn" lay-submit="" lay-filter="submit">{$tran.save}</button>
                    <button type="reset" class="layui-btn layui-btn-primary">{$tran.reset}</button>
                    <button type="button" class="layui-btn layui-btn-primary"
                        lay-active="i18n_back">{$tran.back}</button>
                </div>
            </div>
        </div>
    </div>
</form>

{include file='admin/inc/form.html'}

{include file='admin/footer.html'}